package org.yscz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.yscz.entity.Question;
import org.yscz.mapper.QuestionMapper;
import org.yscz.service.QuestionService;

import java.util.List;

/**
 * @author muqs
 * @create 2021-08-20 17:48
 */
@Service
@Slf4j
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements QuestionService {

    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public Question add(Question question) {
        questionMapper.insert(question);
        return question;
    }

    @Override
    public void modify(Question question) {
        questionMapper.updateById(question);
    }

    @Override
    public void del(Long questionId) {
        questionMapper.deleteById(questionId);
    }

    @Override
    public List<Question> list(QueryWrapper queryWrapper) {
        return questionMapper.selectList(queryWrapper);
    }
}
